<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    function Person(name, age) {
        // this -> 构造函数Person在执行过程中创建的是实例化对象
        this.name = name;
        this.age = age;
    }
    Person.prototype.species = "human";
    Person.prototype.skill = function () {
        console.log("thinking");
    }
    Person.prototype.say = function () {
        console.log(this.name, this.age);
    }


</script>
<script>
    // 构造函数Object的静态方法
    // Object.create()  创建一个空对象({}),并指定对象的原型属性[[Prototype]]指向

    var o = Object.create(null);  // {}
    console.log(o);


    var o = Object.create(Person.prototype);  // {}
    console.log(o);

    // 等价于
    // function Fn() { }
    // Fn.prototype = Person.prototype;
    // new Fn();






















</script>

</html>